//  引入文件
import Vue from 'vue';
import VueRouter from 'vue-router';

//引入组件
import Login from '../views/Login';
import Search from '../views/Search';
import Register from '../views/Register';
import Home from '../views/Home';
import Detail from '../views/Detail';
import AddCartSuccess from '../views/AddCartSuccess'
import ShopCart from '../views/ShopCart'

//注册
Vue.use(VueRouter);
//创建router路由器并导出
const router = new VueRouter({
  //更改路由模式
  mode: 'history',
  //创建多个路由
  routes: [
    //home页面
    {
      path: '/home',
      component: Home,
      meta: {
        isTypeshow: true,
      },
    },
    //重定向
    {
      path: '/',
      redirect: '/home',
    },
    //登录页面
    {
      path: '/login',
      component: Login,
      meta: {
        isFooterShow: true,
      },
    },
    //注册页面
    {
      path: '/register',
      component: Register,
      meta: {
        isFooterShow: true,
      },
    },
    //搜索页面
    {
      path: '/search',
      component: Search,
      meta: {
        isTypeshow: true,
      },
    },
    //detail详情页面
    {
      path: '/detail/:id',
      component: Detail,
      meta: {
        isTypeshow: true,
      },
    },
    //加入购物车页面
    {
      path: '/addCart',
      component: AddCartSuccess,
      meta: {
        isTypeshow: true,
      },
    },
    //购物车
    {
      path: '/shopCart',
      component: ShopCart,
      meta: {
        isTypeshow: true,
      },
    },
  ],
});

//导出store
export default router;
